﻿using System;
using System.Collections.Generic;

namespace Reactor.Messaging.ServiceBus
{
    /// <summary>
    /// Contains event data for messages being sent or received through the service bus.
    /// </summary>
    public class MessageEventArgs : EventArgs
    {
        /// <summary>
        /// Gets or sets the message sent that was sent or received through the service bus.
        /// </summary>
        /// <value>The message sent.</value>
        public object Message { get; set; }

        /// <summary>
        /// Gets or sets the MessagingChannel either to which the message was sent or from which it was received.
        /// </summary>
        /// <value>The MessagingChannel.</value>
        public IMessagingChannel MessagingChannel { get; set; }
    }

    /// <summary>
    /// Contains event data for RunStatusChanged events. The IsRunning boolean property 
    /// indicates whether or not the instance is running.
    /// </summary>
    public class RunStatusChangedEventArgs : EventArgs
    {
        /// <summary>
        /// Gets or sets a value indicating whether this instance is running.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is running; otherwise, <c>false</c>.
        /// </value>
        public bool IsRunning { get; set; }
    }

    /// <summary>
    /// Contains event data for SubscriptionUpdated events. There are two dictionaries 
    /// containing details on subscriptions that were created or terminated thus causing 
    /// the event to be raised.
    /// </summary>
    public class SubscriptionUpdateEventArgs : EventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SubscriptionUpdateEventArgs"/> class.
        /// </summary>
        public SubscriptionUpdateEventArgs()
        {
            SubscriptionsCreated = new Dictionary<IMessagingChannel, Type[]>();
            SubscriptionsTerminated = new Dictionary<IMessagingChannel, Type[]>();
        }

        /// <summary>
        /// Gets or sets the subscriptions created.
        /// </summary>
        /// <value>The subscriptions created.</value>
        public IDictionary<IMessagingChannel, Type[]> SubscriptionsCreated { get; set; }

        /// <summary>
        /// Gets or sets the subscriptions terminated.
        /// </summary>
        /// <value>The subscriptions terminated.</value>
        public IDictionary<IMessagingChannel, Type[]> SubscriptionsTerminated { get; set; }
    }
}
